﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace Pixysoft.Framework.Reflection.Core
{
    class DynamicMethodReturnMessage : DynamicMethodMessage, IDynamicMethodReturnMessage
    {
        Exception _ex;

        object _returnValue;

        internal DynamicMethodReturnMessage(MethodInfo methodInfo, Exception ex, object returnValue)
            : base(methodInfo)
        {
            this._ex = ex;
            this._returnValue = returnValue;
        }

        public Exception Exception
        {
            get { return _ex; }
        }

        public object ReturnValue
        {
            get { return _returnValue; }
        }

        public override void Dispose()
        {
            this._ex = null;

            this._returnValue = null;

            base.Dispose();
        }
    }
}
